package com.Daisy.swi.server.Data;

import java.io.Serializable;
import java.util.ArrayList;

public class BookList implements Serializable{
	private static final long serialVersionUID = 1322310110973987759L;
	private ArrayList<Book> books=new ArrayList<Book>();
	
	public void add(Book b){
		books.add(b);
	}
	
	public void remove(Book b){
		books.remove(b);
	}
	
	public void remove(int i){
		books.remove(i);
	}

	public Book get(int i){
		return books.get(i);
	}
	
	public int size(){
		return books.size();
	}
	
	public boolean contains(Book book){
		return books.contains(book);
	}
	
	public void clear() {
		books.clear();
	}

	public Book getByBarCode(String barCode) {
		for (Book book : books) {
			if (book.getBarCode().equals(barCode)) {
				return book;
			}
		}
		
		return null;
	}
}
